package cn.itcast.order;

//import cn.itcast.feign.clients.UserClient;
//import cn.itcast.feign.config.DefaultFeignConfiguration;
//import org.springframework.cloud.openfeign.EnableFeignClients;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.context.annotation.Bean;
import org.springframework.web.client.RestTemplate;

@MapperScan("cn.itcast.order.mapper")
@SpringBootApplication
//@EnableFeignClients(clients = UserClient.class,defaultConfiguration = DefaultFeignConfiguration.class)
public class OrderApplication {

    public static void main(String[] args) {
        SpringApplication.run(OrderApplication.class, args);
    }

    //RestTemplate对象能模拟发送HTTP请求，就像客户在浏览器输入一样，
    @Bean
    @LoadBalanced
    public RestTemplate restTemplate(){
        return new RestTemplate();
    }

    //自定义负载均衡规则,bean即IRule的实现类，每一种实现类极为一种规则，此为随机
    //这个对本模块的所有项目生效，在yml中可以在服务属性中指定其负载均衡规则
//    @Bean
//    public IRule  randomRule(){
//       return new RandomRule();
//    }
}